import { createRouter, createWebHistory } from 'vue-router'
import employees from "./employees.js";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/index',
      name: 'index',
      component: () => import('../views/Index.vue'),
      children: [
        {
          path: '/index/home',
          name: 'home',
          component: () => import('../views/Index/Home.vue'),
          children: [
            // hwj负责模块

            //3、 首页
            {
              path: '/index/home/hwj/homepage',
              name: 'homepage',
              component: () => import('../views/Index/Home/hwj/homepage.vue'),
            },
            // 4、商机管理
            //  4.1 创建商机
            {
              path: '/index/home/hwj/business',
              name: 'business',
              meta: '商机',
              component: () => import('../views/Index/Home/hwj/business.vue'),
            },
            // 4.2编辑商机businessDetails
            {
              path: '/index/home/hwj/businessedit',
              name: 'businessedit',
              component: () => import('../views/Index/Home/hwj/businessEdit.vue'),
            },
            // 4.3商机详情 
            {
              path: '/index/home/hwj/businessdetails',
              name: 'businessdetails',
              component: () => import('../views/Index/Home/hwj/businessDetails.vue'),
            },
            // 4.3搜索商机 
            {
              path: '/index/home/hwj/searchbusiness',
              name: 'searchbusiness',
              component: () => import('../views/Index/Home/hwj/searchBusiness.vue'),
            },
            // 4.4商机信息列表
            {
              path: '/index/home/hwj/businesslist',
              name: 'businesslist',
              component: () => import('../views/Index/Home/hwj/businessList.vue'),
            },
            // 4.5商机信息列表2
            {
              path: '/index/home/hwj/businesslist2',
              name: 'businesslist2',
              component: () => import('../views/Index/Home/hwj/businessList2.vue'),
            },


            // lsl负责模块
            //5、产品管理
            {
              path: '/index/home/lsl/product',
              name: 'product',
              component: () => import('../views/Index/Home/lsl/product.vue'),
            },
            // 创建产品
            {
              path: '/index/home/lsl/Newproducts',
              name: 'Newproducts',
              component: () => import('../views/Index/Home/lsl/Newproducts.vue'),
            },
            // 6、合同管理
            {
              path: '/index/home/lsl/contract',
              name: 'contract',
              component: () => import('../views/Index/Home/lsl/contract.vue'),
            },
            // 创建合同
            {
              path: '/index/home/lsl/createContract',
              name: 'createContract',
              component: () => import('../views/Index/Home/lsl/createContract.vue'),
            },
            // 合同详情
            {
              path: '/index/home/lsl/ContractDetails',
              name: 'ContractDetails',
              component: () => import('../views/Index/Home/lsl/ContractDetails.vue'),
            },
            // 搜索合同
            {
              path: '/index/home/lsl/SearchContracts',
              name: 'SearchContracts',
              component: () => import('../views/Index/Home/lsl/SearchContracts.vue'),
            },
            // 编辑合同
            {
              path: '/index/home/lsl/EditContract',
              name: 'EditContract',
              component: () => import('../views/Index/Home/lsl/EditContract.vue'),
            },
            // lzn负责模块
            // 7、信息管理
            {
              path: '/index/home/lzn/InfoManage',
              name: 'InfoManage',
              component: () => import('../views/Index/Home/lzn/InfoManage.vue'),
            },
            {
              path: '/index/home/lzn/InfoManage/ContactList',
              name: 'ContactList',
              component: () => import('../views/Index/Home/lzn/InfoManage/ContactList.vue'),
            },
            {
              path: '/index/home/lzn/InfoManage/CreateContact',
              name: 'CreateContact',
              component: () => import('../views/Index/Home/lzn/InfoManage/CreateContact.vue'),
            },
            {
              path: '/index/home/lzn/infoManage/CreateInfo',
              name: 'CreateInfo',
              component: () => import('../views/Index/Home/lzn/InfoManage/CreateInfo.vue'),
            },
            {
              path: '/index/home/lzn/infoManage/EditInfo',
              name: 'EditInfo',
              component: () => import('../views/Index/Home/lzn/InfoManage/EditInfo.vue'),
            },
            {
              path: '/index/home/lzn/infoManage/InfoDetail',
              name: 'InfoDetail',
              component: () => import('../views/Index/Home/lzn/InfoManage/InfoDetail.vue'),
            },
            {
              path: '/index/home/lzn/infoManage/SearchInfo',
              name: 'SearchInfo',
              component: () => import('../views/Index/Home/lzn/InfoManage/SearchInfo.vue'),
            },
            // xhz负责模块

            // 8、用户管理
            {
              path: '/index/home/xhz/users',
              name: 'users',
              component: () => import('../views/Index/Home/xhz/users.vue'),
            },
            {
              path: '/index/home/xhz/raise',
              name: 'raise',
              component: () => import('../views/Index/Home/xhz/raise.vue'),
            },
            {
              path: '/index/home/xhz/empower',
              name: 'empower',
              component: () => import('../views/Index/Home/xhz/empower.vue'),
            },
            {
              path: '/index/home/xhz/redact',
              name: 'redact',
              component: () => import('../views/Index/Home/xhz/redact.vue'),
            },
            {
              path: '/index/home/xhz/inquire',
              name: 'inquire',
              component: () => import('../views/Index/Home/xhz/inquire.vue'),
            },
            {
              path: '/index/home/xhz/check',
              name: 'check',
              component: () => import('../views/Index/Home/xhz/check.vue'),
            },
            {
              path: '/index/home/xhz/password',
              name: 'password',
              component: () => import('../views/Index/Home/xhz/password.vue'),
            },

            //  zqq负责模块
            // 9、日志管理
            {
              path: '/index/home/zqq/logs',
              name: 'logs',
              component: () => import('../views/Index/Home/zqq/logs.vue'),
            },

            //10、员工管理
            ...employees,
            {
              path: '/index/home/zqq/employees',
              name: 'employees',
              component: () => import('../views/Index/Home/zqq/employees.vue'),
            },


          
            // 找不到地址跳错误提示页面
            {
              path: '/:error(.*)',
              component: () => import('../views/NotFound.vue')
            },
       
        

          ]
        },
        {
          path: '/index/contact',
          name: 'contact',
          component: () => import('../views/Index/Contact.vue'),
        },
        {
          path: '/index/order',
          name: 'order',
          component: () => import('../views/Index/Order.vue'),
        },

   
        // 路由重定向
        {
          path: '/',
          redirect: '/index/home'
        },
        // 找不到地址跳错误提示页面
        {
          path: '*',
          component: () => import('../views/NotFound.vue')
        },
      ]

    },
    // 1、注册
    {
      path: '/register',
      name: 'register',
      component: () => import('../views/Register.vue'),
    },
    // 2、登录
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/Login.vue'),
    },
    // 路由重定向
    {
      path: '/',
      redirect: '/index/home/hwj/homepage'
    },
    // 找不到地址跳错误提示页面
    {
      path: '/:error(.*)',
      component: () => import('../views/NotFound.vue')
    },

  ]
})

export default router
